import 'package:Smart/utils/routers/page_jump_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
//屏幕适配
import 'package:Smart/utils/screen_unit/gs_screen_util.dart';
//字体颜色
import '../res/colors_res.dart';

/**使用蓝牙钥匙对话框--一个按钮---我知道了 */
class GSOnlyBlueToothDialog extends StatefulWidget {
  GSOnlyBlueToothDialog({Key key}) : super(key: key);

  @override
  _GSOnlyBlueToothDialogState createState() => _GSOnlyBlueToothDialogState();
}

class _GSOnlyBlueToothDialogState extends State<GSOnlyBlueToothDialog> {
  bool checked = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.transparent,
      body: Center(
        child: Container(
          child: Stack(
            // overflow: Overflow.visible,
            alignment: Alignment.center,
            children: <Widget>[
              Container(
                width: 314.w,
                margin: EdgeInsets.symmetric(vertical: 140.w),
                padding: EdgeInsets.only(left: 12.w, right: 12.w, bottom: 24.w),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10.w),
                  color: ColorsRes.color_ffffff,
                ),
                //弹框开始
                child: Container(
                  margin: EdgeInsets.only(top: 49.w),
                  child: Column(
                    mainAxisSize: MainAxisSize.min,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: <Widget>[
                      //弹框中间部分内容
                      Container(
                        alignment: Alignment.centerLeft,
                        width: 260.w,
                        // height: 102.w,
                        child: Text(
                          '使用蓝牙钥匙请满足以下条件: 1、手机蓝牙功能已打开；          2、手机靠近车辆；',
                          style: TextStyle(
                              fontSize: 18.w,
                              color: ColorsRes.color_141413,
                              decoration: TextDecoration.none),
                          strutStyle: StrutStyle(
                              forceStrutHeight: true,
                              height: 1.4,
                              leading: 1.3),
                        ),
                      ),
                      //复选框
                      Container(
                        padding: EdgeInsets.only(top: 0),
                        child: Row(
                          children: <Widget>[
                            //可选框
                            Checkbox(
                                value: checked,
                                onChanged: (selected) {
                                  checked = !checked;
                                }),

                            //可选框文字
                            Expanded(
                                child: Text(
                              "下次不再提醒",
                              textAlign: TextAlign.left,
                              style: TextStyle(
                                  color: ColorsRes.color_595959,
                                  fontSize: 14.w,
                                  decoration: TextDecoration.none),
                            ))
                          ],
                        ),
                      ),
                      //按钮“我知道了”
                      Container(
                        alignment: Alignment.center,
                        child: Container(
                          // margin: EdgeInsets.only(top: 10.w),
                          width: 258.w,
                          height: 44.w,
                          decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(26.w),
                              color: ColorsRes.color_D7E600),
                          child: Center(
                            child: GestureDetector(
                              onTap: () {
                                //点击我知道了
                                print('点击我知道了');
                                Navigator.of(context).pop();
                              },
                              child: Text(
                                '我知道了',
                                style: TextStyle(
                                    fontSize: 18.w,
                                    color: ColorsRes.color_141413,
                                    decoration: TextDecoration.none),
                              ),
                            ),
                          ),
                        ),
                      )
                    ],
                  ),
                ),
              ),
              //弹框顶部居中按钮
              Positioned(
                top: 105.w,
                child: Container(
                  child: Image.asset(
                    "assets/images/productor006/蓝牙钥匙.png",
                    width: 68.w,
                    height: 68.w,
                  ),
                ),
              ),
              //弹出框底部关闭按钮
              Positioned(
                bottom: 0,
                child: GestureDetector(
                  onTap: () {
                    //点击关闭
                    Navigator.of(context).pop();
                  },
                  child: Container(
                    child: Image.asset(
                      "assets/images/productor006/popclose.png",
                      width: 45.w,
                      height: 45.w,
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

//两个按钮的对话框---确认开启 取消----继续激活  放弃激活
Widget GSBlueToothDialog(
  BuildContext context,
  String message,
  String cancelTxt,
  String confrimTxt,
) {
  return Scaffold(
    backgroundColor: Colors.transparent,
    body: Center(
      child: Container(
        child: Stack(
          alignment: Alignment.center,
          children: <Widget>[
            Container(
              width: 314.w,
              height: 321.w,
              padding: EdgeInsets.only(left: 12.w, right: 12.w, bottom: 24.w),
              margin: EdgeInsets.symmetric(vertical: 140.w),
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(10.w),
                color: ColorsRes.color_ffffff,
              ),
              //弹框开始
              child: Container(
                margin: EdgeInsets.only(top: 62.w),
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: <Widget>[
                    //中间部分内容
                    Container(
                      alignment: Alignment.centerLeft,
                      width: 260.w,
                      height: 138.w,
                      child: Text(
                        message,
                        style: TextStyle(
                            fontSize: 18.w,
                            color: ColorsRes.color_141413,
                            decoration: TextDecoration.none),
                        strutStyle: StrutStyle(
                            forceStrutHeight: true, height: 1.4, leading: 1.3),
                      ),
                    ),
                    //按钮部分
                    Container(
                      padding: EdgeInsets.only(
                        top: 30.w,
                      ),
                      child: Row(
                        // mainAxisSize: MainAxisSize.min,
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: <Widget>[
                          //弹框'取消'按钮
                          GestureDetector(
                            onTap: () {
                              Navigator.of(context).pop();
                            },
                            child: Container(
                              width: 137.w,
                              height: 44.w,
                              decoration: BoxDecoration(
                                  borderRadius: BorderRadius.circular(26.w),
                                  border: Border.all(
                                      color: ColorsRes.color_D7E600)),
                              child: Center(
                                child: Text(
                                  cancelTxt,
                                  style: TextStyle(
                                      color: ColorsRes.color_141413,
                                      fontSize: 18.w,
                                      decoration: TextDecoration.none),
                                ),
                              ),
                            ),
                          ),
                          //弹框'确认'按钮
                          GestureDetector(
                            onTap: () {
                              Navigator.of(context).pop();
                            },
                            child: Container(
                              width: 137.w,
                              height: 44.w,
                              decoration: BoxDecoration(
                                  color: Color(0xffD1E000),
                                  borderRadius: BorderRadius.circular(26.w),
                                  border: Border.all(
                                      color: ColorsRes.color_D7E600)),
                              child: Center(
                                child: Text(
                                  confrimTxt,
                                  style: TextStyle(
                                      color: ColorsRes.color_141413,
                                      fontSize: 18.w,
                                      decoration: TextDecoration.none),
                                ),
                              ),
                            ),
                          )
                        ],
                      ),
                    )
                  ],
                ),
              ),
            ),
            //弹框顶部居中按钮
            Positioned(
              // left: 110,
              top: 105.w,
              child: Container(
                child: Image.asset(
                  "assets/images/productor006/蓝牙钥匙.png",
                  width: 68.w,
                  height: 68.w,
                ),
              ),
            ),
            //弹出框底部关闭按钮
            Positioned(
              bottom: 0,
              child: GestureDetector(
                onTap: () {
                  Navigator.of(context).pop();
                },
                child: Container(
                  child: Image.asset(
                    "assets/images/productor006/popclose.png",
                    width: 45.w,
                    height: 45.w,
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    ),
  );
}
